App({
  deviceid: '',
  issaoma:'',
  onLaunch(options) {
    if (options.query){
      var str = JSON.stringify(options.query.qrCode)
      this.deviceid = str.substring(str.length - 12, str.length-1)
      this.issaoma = true;
      my.setStorage({
        key: 'deviceid', // 缓存数据的key
        data: str.substring(str.length - 12, str.length-1), // 要缓存的数据
        success: (res) => {
          
        },
      });
    }else{
      this.deviceid = 'M2018000143';
      this.issaoma = false;
    }
  },
  onShow(options) {
  },
  getUserInfo() {
    return new Promise((resolve, reject) => {
      if (this.userInfo) resolve(this.userInfo);

      my.getAuthCode({
        scopes: ['auth_user'],
        success: authcode => {
          // console.info(authcode);

          my.getAuthUserInfo({
            success: res => {
              this.userInfo = res;
              resolve(this.userInfo);
            },
            fail: () => {
              reject({});
            },
          });
        },
        fail: () => {
          reject({});
        },
      });
    });
  },
});
